/**
 * Create in 2012-7-27.
 */
package kit4j.tests.jdk.swing.dnd.table;

import java.awt.Component;

import javax.swing.JButton;

/**
 * 按钮数据的表格拖放数据模型实现。
 * 
 * @author MiniKnife
 * 
 */
public class DndTableButtonModel implements DndTableModel<JButton> {

	private JButton object;

	private int colspan;

	private int rowspan;

	public DndTableButtonModel(JButton model) {
		this(model, 1, 1);
	}

	public DndTableButtonModel(JButton model, int colspan, int rowspan) {
		setObject(model);
		setColspan(colspan);
		setRowspan(rowspan);
	}

	/**
	 * @param model
	 *            the model to set
	 */
	public void setObject(JButton model) {
		this.object = model;
	}

	/**
	 * @param colspan
	 *            the colspan to set
	 */
	public void setColspan(int colspan) {
		this.colspan = colspan;
	}

	/**
	 * @param rowspan
	 *            the rowspan to set
	 */
	public void setRowspan(int rowspan) {
		this.rowspan = rowspan;
	}

	/**
	 * @see kit4j.tests.jdk.swing.TestDragAndDrop.DndTableModel#getObject()
	 */
	@Override
	public JButton getObject() {
		return object;
	}

	/**
	 * @see kit4j.tests.jdk.swing.TestDragAndDrop.DndTableModel#getModelRendererComponent()
	 */
	@Override
	public Component getModelRendererComponent() {
		return object;
	}

	/**
	 * @see kit4j.tests.jdk.swing.TestDragAndDrop.DndTableModel#getColspan()
	 */
	@Override
	public int getColspan() {
		return colspan;
	}

	/**
	 * @see kit4j.tests.jdk.swing.TestDragAndDrop.DndTableModel#getRowspan()
	 */
	@Override
	public int getRowspan() {
		return rowspan;
	}

}